package tcln.gxtx.client.widget.treegrid;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGridView;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel.Joint;
import com.google.gwt.user.client.ui.AbstractImagePrototype;

/**
 * @param <M>
 *            the model type
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public interface TreeGridExtension<M extends ModelData> {
    Joint calcualteJoint(M model);

    /**
     * calculates icon style for FOLDER/LEAF node (next to collapse/expand icon).
     * 
     * @param model
     * @return
     */
    AbstractImagePrototype calculateIconStyle(M model);

    /**
     * Gets a node ID for a given model.
     * 
     * @param m
     * @return
     */
    String findNodeId(final M m);

    /**
     * Finds a tree node for given model.
     * 
     * @param m
     * @return
     */
    TreeGrid<M>.TreeNode findNode(M m);

    /**
     * Returns the tree's tree store.
     * 
     * @return the tree store
     */
    TreeStore<M> getTreeStore();

    /**
     * Returns the tree's view.
     * 
     * @return the view
     */
    TreeGridView getTreeView();
    
    /**
     * Sets new value for nodeIconStyleHidden.
     * 
     * @param nodeIconStyleHidden
     *            the nodeIconStyleHidden to set.
     */
    void setNodeIconStyleHidden(boolean nodeIconStyleHidden);
}
